﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Solution.Application.Commands.Dtos;
using System.Threading.Tasks;

namespace Solution.WebHost.Controllers
{
    [Authorize]
    [ApiController]
    [Route("api/[controller]")]
    public class SystemController : ControllerBase
    {
        private readonly IMediator _mediator;
        public SystemController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [AllowAnonymous]
        [Route("authorize")]
        public async Task<IHandlerResult> Authorize([FromBody] Application.Commands.System.Authorize.Request request)
        {
            return await _mediator.Send(request);
        }
    }
}